+2008-05-20 Jan Heller <jheller@svn.gnome.org>
+
+ * extensions/gimp-8bit.c (conv_rgbaF_linear_rgb8_linear),
+ (conv_rgbaF_linear_rgba8_linear), (init): added naive versions
+ of respective conversions.
+
2008-05-14 Sven Neumann <sven@gimp.org>
* babl/babl-format.c (format_new): initialize format.visited.
return samples;
}
+static INLINE long
+conv_rgbaF_linear_rgb8_linear (unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ float *fsrc = (float *) src;
+ long n = samples;
+ long int v;
+
+ while (n--)
+ {
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ fsrc++;
+ }
+
+ return samples;
+}
+
+static INLINE long
+conv_rgbaF_linear_rgba8_linear (unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ float *fsrc = (float *) src;
+ long n = samples;
+ long int v;
+
+ while (n--)
+ {
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+ }
+
+ return samples;
+}
+
int init (void);
int
o (g8_gamma_2_2, gF_linear);
o (g8_linear, rgbaF_linear);
o (g8_gamma_2_2, rgbaF_linear);
+
+ o (rgbaF_linear, rgb8_linear);
+ o (rgbaF_linear, rgba8_linear);
+
return 0;
}